<template>
<!-- 首页帖子列表页面 -->
  <div>
    <el-row justify="space-around" class="themeContent">
      <el-col
        :span="8"
        v-for="item in allCategoryList"
        :key="item.name"
        class="category-item"
        @click.native.capture="detail(item)"
      >
        <!-- <router-link :to="{path:'/themeArtList',query:{categoryId:item.categoryId,name:item.name}}"></router-link> -->
        <img :src="item.cover" alt class="themeImg" />
        <p>{{item.name}}</p>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { getCategoryList } from "../api/luntan-api";

export default {
  created() {
    getCategoryList().then(res => {
      // console.log(res);
      this.allCategoryList = res.rows;
    });
  },
  data() {
    return {
      allCategoryList: []
    };
  },
  methods: {
    detail(item) {
      this.$router.push({
        path: "/home/theme-posts-list",
        query: { categoryId: item.categoryId, name: item.name }
      });
    }
  }
};
</script>

<style lang="less" scoped>
.themeContent {
  height: calc(100vh - 150px);
  overflow: scroll;
}

p {
  height: 12px;
  font-weight: 700;
}
.themeImg {
  width: 100px;
  height: 100px;
  border-radius: 30%;
  margin-top: 20px;
}
</style>